Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Seconds not properly prevented from being negative #1310

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

olfek
Copy link

@olfek olfek commented Sep 17, 2024

The current code ...

second += Number(UserSettings.items.offset) + 60;

... fails in these two examples:

0 - 61 + 60 < 0
59 - 120 + 60 < 0

The offset (middle value) can be as low as -300.

if (Math.abs(offset) <= 300) {

So the least you can have is -241 (59 - 300), the + 60 is not enough to make a positive number.


Without this fix, in the examples given above, the effect will be:

Countdown circle animation may be out of sync with the current time step because animationDelay will be stuck at 0s.

<svg viewBox="0 0 16 16">
<circle
cx="8"
cy="8"
r="4"
v-bind:style="{
animationDuration: entry.period + 's',
animationDelay: (sectorOffset % entry.period) + 's',

timeout class will never activate unless entry.period < 5 because the left side of the < condition will be stuck at entry.period.

timeout: entry.period - (second % entry.period) < 5,

@olfek
Copy link
Author

olfek commented Sep 17, 2024

Requesting review @Sneezry @mymindstorm

@mymindstorm
Copy link
Member

It's on my to-do list, but might take me a while to get to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants